package miniBanco.Gui;

import java.awt.BorderLayout;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import miniBanco.Dto.ClienteLoginDTO;
import MySwing.JFormField;

public class WinLoginCliente extends JDialog {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JButton buttonAceptar;
	private JFormField txtCliente;
	private JFormField txtDni;
	private JPanel panel;
	private BorderLayout borderLayout;
	public Boolean ReturnValue;
	public WinLoginCliente()
	{
		panel = new JPanel();
		buttonAceptar = new JButton();
		buttonAceptar.setText("Aceptar");
		
		borderLayout = new BorderLayout();
		txtCliente = new JFormField("Cliente", 25);
		txtDni = new JFormField("Dni", 25);

		panel.setLayout(borderLayout);
		panel.add(txtCliente,BorderLayout.NORTH);
		panel.add(txtDni,BorderLayout.CENTER);
		panel.add(buttonAceptar,BorderLayout.SOUTH);

		this.setModalityType(ModalityType.APPLICATION_MODAL);
        getContentPane().add(panel);
        pack();
        setLocationRelativeTo(null);
	}
	
	public JButton getButtonAceptar()
	{
		return buttonAceptar;
	}
	
	public ClienteLoginDTO getFormValues()
	{
		ClienteLoginDTO clienteDTO = new ClienteLoginDTO();
		String userName;
		int dni;
		userName = txtCliente.getTextField().getText();
		dni = Integer.parseInt(txtDni.getTextField().getText());
		clienteDTO.setDni(dni);
		clienteDTO.setCliente(userName);
		return clienteDTO;
	}
}
